
package View;

import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.*;


public class MainView extends JFrame{
    public JPanel mainPanel;
    public JLabel mainLogoL;
    public JButton mainLoginB;
    public JButton mainLogoutB;
    public JButton mainOrderB;
    public JButton mainAdminB;
    public JButton mainSmpsB;
    
    //Constructor
    public MainView(){
        mainPanel = new JPanel();
        mainLogoL = new JLabel("Welcome                         ");
        
        mainLoginB = new JButton("LOGIN");
        mainLoginB.setMnemonic(KeyEvent.VK_L);
        
        mainLogoutB = new JButton("LOGOUT");
        mainLogoutB.setMnemonic(KeyEvent.VK_T);
        mainLogoutB.setVisible(false);
        
        mainOrderB = new JButton("ORDER");
        mainOrderB.setMnemonic(KeyEvent.VK_O);
        mainOrderB.setEnabled(false);
        
        mainAdminB = new JButton("ADMIN");
        mainAdminB.setMnemonic(KeyEvent.VK_A);
        mainAdminB.setEnabled(false);
        
        mainSmpsB = new JButton("SMPS");
        mainSmpsB.setMnemonic(KeyEvent.VK_S);
        mainSmpsB.setEnabled(false);
        
        mainPanel.add(mainLogoL);
        mainPanel.add(mainLoginB);
        mainPanel.add(mainLogoutB);
        mainPanel.add(mainOrderB);
        mainPanel.add(mainAdminB);
        mainPanel.add(mainSmpsB);
        //mainPanel.setSize(600, 200);
        mainPanel.setOpaque(true);
        
        this.add(mainPanel);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //this.setSize(600, 150);
        this.pack();
        this.setVisible(true);
    }
    
     //If the  MainLoginButton is clicked execute a method in the MainController named actionPerformed
    public void addMainLoginButtonListener(ActionListener listenForMainLoginButton){
        mainLoginB.addActionListener(listenForMainLoginButton);
    }
    
    //If the  MainLogoutButton is clicked execute a method in the MainController named actionPerformed
    public void addMainLogoutButtonListener(ActionListener listenForMainLogoutButton){
        mainLogoutB.addActionListener(listenForMainLogoutButton);
    }
    
    //if the MainOrderButton is clicked execute a method in the MainController named actionPerformed
    public void addMainOrderButtonListener(ActionListener listenForMainOrderButton){
        mainOrderB.addActionListener(listenForMainOrderButton);
    }
}
